package olga.gorbatiuk.perdep.sorting;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Olga Gorbatiuk
 */
public class Main {

    private static final String PATH_TO_SORTING_ALGORITHMS_IMPLEMENTATIONS = "src/main/java/olga/gorbatiuk/perdep/sorting/sort/impl";
    private static final String PATH_TO_ARRAYFILLERS_IMPLEMENTATIONS = "src/main/java/olga/gorbatiuk/perdep/sorting/arrayfiller/impl";

    /**
     * The main method.
     *
     * @param args the arguments
     * @throws NoSuchMethodException the no such method exception
     * @throws IllegalAccessException the illegal access exception
     * @throws InvocationTargetException the invocation target exception
     * @throws InstantiationException the instantiation exception
     */
    public static void main(String[] args) throws NoSuchMethodException,
            IllegalAccessException, InvocationTargetException,
            InstantiationException {

//	Create list of all sorting algorithms classes
        List<Class<?>> sortingAlgorithms = ReflectionUtils
                .getListOfClassesFromLocation(PATH_TO_SORTING_ALGORITHMS_IMPLEMENTATIONS);

//	Create list of all arrayfillers classes
        List<Class<?>> arrayFillers = ReflectionUtils
                .getListOfClassesFromLocation(PATH_TO_ARRAYFILLERS_IMPLEMENTATIONS);

//	Create list of desired array's parameters 
        List<ArrayParameters> arrayParametersList = new ArrayList<>();
        arrayParametersList.add(new ArrayParameters(1, 17, 10));
        arrayParametersList.add(new ArrayParameters(0, 50, 50));
        arrayParametersList.add(new ArrayParameters(1, 200, 100));
        arrayParametersList.add(new ArrayParameters(1, 100, 150));

        Benchmark
                .evaluate(sortingAlgorithms, arrayFillers, arrayParametersList);
    }
}
